<?php
// +----------------------------------------------------------------------------
// | Tke团队版权所属 [三十年河东三十年河西,莫欺少年穷.!]
// +----------------------------------------------------------------------------
// | Copyright (c) 2014 http://www.itdaodan.com All rights reserved.
// +----------------------------------------------------------------------------
// | Author: PHP@妖孽 <dino_ma@163.com>
// +----------------------------------------------------------------------------
/**
 +------------------------------------------------------------------------------
 * Home 路由控制
 +------------------------------------------------------------------------------
 * @version   1.0
 * @since 2015-01-22
 +------------------------------------------------------------------------------
 */
namespace Home\Controller;
use Think\Controller;

class RouteController extends Controller {
    
    private $host = 'next.hrbjjhh.com'; // 主页url
    private $activity_id = 42; // 家博会活动id
    
    public function index(){
        
        // get
        $get = http_build_query($_GET);
        $get_str = (empty($get))? '' : '?'.$get;
        // host
        $host_arr = explode('.', $_SERVER['HTTP_HOST']);
        $arr = array_slice($host_arr, 0, count($host_arr) - 2);
        $route = implode('.', $arr);
        switch ($route){
            // 天天特卖
            case 'tm':
                header('Location:http://'.$this->host.'/shop-sale.html'.$get_str);
                break;
            // 家博会
            case 'jbh':
                header('Location:http://'.$this->host.'/activity-index-id-'.$this->activity_id.'.html'.$get_str);
                break;
            default:break;
        }
    }
}